1. Field of Invention
The field of the invention relates to computer database management systems, computer database application programs, and computer operating systems. In particular, the field of the invention relates to a method and apparatus for performing deferred transactions and undoing prior modifications of data in a database application environment.
2. Related Art
Database management systems are in wide spread use in both stand alone computer systems, such as main frames, as well as in client-server distributed computer systems. Database application programs operate by retrieving data items from these database management systems, performing modifications on these data items, and finally returning the data items to the database management systems. Database management systems are usually accessed through interface functions which control the manner in which data can be accessed, and thereby maintain integrity of the data inside the database management system.
A particular challenge is posed by database application programs which support multi-threaded operation, which can unpredictably affect a data item after is has been retrieved from a database management system. In multi-threaded operation, performance is improved by splitting up the functions of a database application into a set of independently executable tasks. These tasks are then separately executed by a collection of "threads." This allows the tasks of a database application to be accomplished concurrently, which can greatly increase database application performance. If one thread blocks while performing a particular operation, for example retrieving something from the database management system, another thread can continue to execute another task.
Multi-threading complicates the process of maintaining the integrity of a data item after it has been retrieved from the database management system. In particular, multi-threading complicates the process of moving a data item from a computer's local memory to the database management system. While one thread is writing the data item to the database, another thread can potentially modify the data item. This can create inconsistencies in the data item if a modification is only partly recorded as the data item is stored to the database management system. Conventional database applications prevent this problem by locking the data item while it is being written to the database management system, so that other threads cannot access it. This locking operation will ensure the data item is stored to the database management system in a consistent state. However, the data item is not accessible by other threads during this commit operation, and system performance can suffer if other threads attempt to access the data items while the commit operation is taking place. This performance delay is particularly noticeable to a human user of the database application program who requests that a data item be stored to the database management system. The human user will typically have to wait until the data item is committed to the database management system before proceeding to operate on the data item.
The performance drawbacks from locking can be overcome in a number of ways. Database application programs can simply eliminate multi-threaded operation, which will eliminate the need to perform any locking. However, doing so will seriously degrade database application performance. Alternatively, the database application user can simply perform fewer commit operations, which will eliminate the delay associated with the commit operations. However, performing fewer commit operations will increase the risk that modifications to data items will be lost during a system failure.